package com.my.company.base.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.my.company.base.dao.BaseDao;
import com.my.company.base.service.BaseService;



/**
 * @author <a href="mailto:985838781@qq.com">wangyaqi</a>
 * @version examsy1.0 2014年12月26日 下午5:10:45
 */
@SuppressWarnings("rawtypes")
public class BaseServiceImpl<T> implements BaseService<T> {

	
	private BaseDao dao;
	@Resource
	public void setDao(BaseDao dao) {
		this.dao = dao;
	}

	
	@SuppressWarnings("unchecked")
	public void saveEntity(T t) {
		dao.saveEntity(t);
	}

	@SuppressWarnings("unchecked")
	public void updateEntity(T t) {
		dao.updateEntity(t);
	}

	@SuppressWarnings("unchecked")
	public void deleteEntity(T t) {
		dao.deleteEntity(t);
	}

	@SuppressWarnings("unchecked")
	public void saveOrUpdateEntity(T t) {
		dao.saveOrUpdateEntity(t);
	}

	public void batchEntityByHQL(String hql, Object... objects) {
		dao.batchEntityByHQL(hql, objects);
	}
	@SuppressWarnings("unchecked")
	public List<T> findEntityByHQL(String hql, Object... objects) {

		return dao.findEntityByHQL(hql, objects);
	}


	@SuppressWarnings("unchecked")
	public T getEntity(String id) {
	
		return (T) dao.getEntity(id);
	}

	@SuppressWarnings("unchecked")
	public T loadEntity(String id) {
		
		return (T) dao.loadEntity(id);
	}
	@SuppressWarnings("unchecked")
	public T getEntity(Integer id) {
	
		return (T) dao.getEntity(id);
	}

	@SuppressWarnings("unchecked")
	public T loadEntity(Integer id) {
		
		return (T) dao.loadEntity(id);
	}


	@SuppressWarnings("unchecked")
	public List<T> getListForPage(String hql, int offset, int length) {
		
		return dao.getListForPage(hql, offset, length);
	}

}
